<template>
  <div id="app">
    <el-container>
      <el-header>
        <el-menu
          :default-active="activeIndex"
          class="nav-menu"
          mode="horizontal"
          router
          @select="handleSelect"
        >
          <el-menu-item index="/">首页</el-menu-item>
          <el-menu-item index="/works">作品展示</el-menu-item>
          <el-menu-item index="/life">生活分享</el-menu-item>
          <el-menu-item index="/skills">技能展示</el-menu-item>
        </el-menu>
      </el-header>
      
      <el-main>
        <router-view />
      </el-main>

      <el-footer>
        <p>© 2024 个人作品展示网站 All Rights Reserved.</p>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      activeIndex: '/'
    }
  },
  watch: {
    $route: {
      immediate: true,
      handler(to) {
        this.activeIndex = to.path
      }
    }
  },
  methods: {
    handleSelect(key) {
      this.activeIndex = key
    }
  }
}
</script>

<style>
#app {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  background-color: #f0f8ff;
}

.el-header {
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  background-color: #fff;
}

.nav-menu {
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.el-main {
  margin-top: 60px;
  min-height: calc(100vh - 120px);
  padding-top: 20px;
}

.el-footer {
  text-align: center;
  background-color: #fff;
  padding: 20px;
  color: #666;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.06);
}

.el-card {
  border-radius: 8px;
  transition: transform 0.3s, box-shadow 0.3s;
  margin-bottom: 20px;
}

.el-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}
</style>
